# In this cmake module
# HELLO_INCLUDE_DIR HELLO_LIBRARY HELLO_FOUND will be defined

FIND_PATH(HELLO_INCLUDE_DIR hello.h /home/sy/workspace/cmake_test/t3/build/install/include/hello)
# 通过FIND_PATH 找到hello.h 文件 路径保存在 HELLO_INCLUDE_DIR 中
# 语法 FIND_PATH(<VAR> name1 path1 path2 ...)

FIND_LIBRARY(HELLO_LIBRARY NAMES hello /home/sy/workspace/cmake_test/t3/build/install/lib)
# 通过 FIND_LIBRARY 找到对应的库文件 路径保存在 HELLO_LIBRARY 中
# FIND_LIBRARY(<VAR> name1 path1 path2 ...)


IF(HELLO_INCLUDE_DIR AND HELLO_LIBRARY)
    SET(HELLO_FOUND TRUE)
ENDIF(HELLO_INCLUDE_DIR AND HELLO_LIBRARY)
# 如果头文件和库文件都找到了 则 HELLO_FOUND=TRUE


IF(HELLO_FOUND)
    IF(NOT HELLO_FIND_QUIETLY)
        # 如果找到了库并且引用方指定是QUIET 则不输出
        MESSAGE(STATUS "Found Hello: ${HELLO_LIBRARY}")
    ENDIF(NOT HELLO_FIND_QUIETLY)
ELSE(HELLO_FOUND)
    IF(HELLO_FIND_REQUIRED)
        # 如果没找到 并且 引用方指定REUQIRED 则报错退出
        MESSAGE(FATAL_ERROR "Could not find hello library")
    ENDIF(HELLO_FIND_REQUIRED)
ENDIF(HELLO_FOUND)